package first.endtoend.tsm.webservices;

import first.endtoend.tsm.TSMHelper;
import org.mbds.wolf.tsm.gp.systems.messaging2_1_0.IServiceEvents;
import org.mbds.wolf.tsm.gp.systems.messaging2_1_0.ksoap2.elements.OperationResult;

import java.util.HashMap;

/**
 * Created by ncordina on 29/06/2015.
 */
public class AdminWsConnectorService extends TSMHelper implements IServiceEvents
{
    private HashMap<String, String> displayUserProfile = new HashMap<String, String>();
    private HashMap<String, String> displayRegisterUser = new HashMap<String, String>();
    private HashMap<String, String> displayLockUser = new HashMap<String, String>();
    private HashMap<String, String> displayUnlockUser = new HashMap<String, String>();

    /**
     * Class Constructor
     * Take the URL of SPTSM Server in parameter and instanciate the CallBack and the controller of Wolf library
     *
     * @param URL
     */
    public AdminWsConnectorService(String URL)
    {
        super(URL);
    }

    @Override
    public void Starting()
    {

    }

    @Override
    public void Completed(OperationResult operationResult)
    {
        //if(operationResult.MethodName.equalsIgnoreCase(GpFunctions.SetUser.getFunction()))
        //{
        //    notify();
        //}
        //if(operationResult.MethodName.equalsIgnoreCase(GpFunctions.RegisterUser.getFunction()))
        //{
        //    notify();
        //}
        //if(operationResult.MethodName.equalsIgnoreCase(GpFunctions.LockUser.getFunction()))
        //{
        //    notify();
        //}
        //if(operationResult.MethodName.equalsIgnoreCase(GpFunctions.UnlockUser.getFunction()))
        //{
        //    notify();
        //}

    }

    public HashMap<String,String> setUserProfile() throws InterruptedException
    {
        wait();
        return displayUserProfile;
    }

    public HashMap<String,String> registerUser() throws InterruptedException
    {
        wait();
        return displayRegisterUser;
    }

    public HashMap<String,String> lockUser() throws InterruptedException
    {
        wait();
        return displayLockUser;
    }

    public HashMap<String,String> unlockUser() throws InterruptedException
    {
        wait();
        return displayUnlockUser;
    }
}
